<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>test</title>
</head>
<body>
  <div class="cont1">1</div>
  <div class="cont2">2</div>
  <div><button>open</button></div>
  <script>
    const dom = document.querySelector("button");
    const dom1 = document.querySelector(".cont1");
    const dom2 = document.querySelector(".cont2");
    dom.addEventListener("click", () => {
      const t = window.open("");
      dom1.innerHTML = String(t);
      setTimeout(() => {
        t.location.href = "https://wwww.baidu.com";
        dom2.innerHTML = String(t);
      }, 3000);
    });
  </script>
</body>
</html>